package com.appwoo.txtws.activity;

import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.Editable;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import com.appwoo.android.activity.BaseActivity;
import com.appwoo.android.exception.NotFoundNetWorkException;
import com.appwoo.android.exception.TimeOutException;
import com.appwoo.txtws.bean.StateBean;
import com.appwoo.txtws.component.MD5Builder;
import com.appwoo.txtws.component.RqSP;
import com.appwoo.txtws.component.UserLoginComp;
import com.appwoo.txtws.service.PasswordService;
import java.io.IOException;
import org.xmlpull.v1.XmlPullParserException;

public class DialogPSWActivity extends BaseActivity
  implements View.OnClickListener
{
  private String alertString = "";
  private EditText jiumima;
  String oldPsw;
  private Button queding;
  private EditText querenmima;
  private Button quxiao;
  private RqSP rp;
  String username;
  private ProgressDialog v_progressDialog;
  private EditText xinmima;

  private void PostShowReg(String paramString)
  {
    if (paramString.equals("0"))
    {
      alertMessage(getString(2131427659));
      new RqSP().setLgPwd(MD5Builder.getMD5(this.xinmima.getText().toString()), this);
      this.jiumima.setText("");
      this.xinmima.setText("");
      this.querenmima.setText("");
      finish();
      return;
    }
    alertMessage(paramString);
  }

  private void addListener()
  {
    this.queding.setOnClickListener(this);
    this.quxiao.setOnClickListener(this);
  }

  private String bgReg()
  {
    this.alertString = "";
    String str = this.xinmima.getText().toString();
    try
    {
      StateBean localStateBean = new PasswordService().changePassword(this.username, this.username, str, this);
      if ((localStateBean.getCode() != null) && (localStateBean.getCode().equals("0")))
        UserLoginComp.saveLoginInfo(this.username, str, getApplication());
      for (this.alertString = localStateBean.getCode(); ; this.alertString = localStateBean.getDesc())
        return this.alertString;
    }
    catch (IOException localIOException)
    {
      while (true)
        this.alertString = getString(2131427524);
    }
    catch (XmlPullParserException localXmlPullParserException)
    {
      while (true)
        this.alertString = getString(2131427524);
    }
    catch (TimeOutException localTimeOutException)
    {
      while (true)
        this.alertString = getString(2131427526);
    }
    catch (NotFoundNetWorkException localNotFoundNetWorkException)
    {
      while (true)
      {
        localNotFoundNetWorkException.getClass();
        this.alertString = "没有连接到网络";
      }
    }
  }

  private void init()
  {
    this.jiumima = ((EditText)findViewById(2131493029));
    this.xinmima = ((EditText)findViewById(2131493030));
    this.querenmima = ((EditText)findViewById(2131493031));
    this.queding = ((Button)findViewById(2131493089));
    this.quxiao = ((Button)findViewById(2131493090));
  }

  private void quedingListener()
  {
    String str1 = this.xinmima.getText().toString();
    String str2 = this.querenmima.getText().toString();
    this.oldPsw = this.jiumima.getText().toString();
    if ((!str1.equals("")) && (!str2.equals("")))
    {
      if (str1.equals(str2))
      {
        if ((str1.length() > 4) && (str1.length() < 17))
        {
          new LoginAsyncTask().execute(new String[] { "reg" });
          return;
        }
        alertMessage(getString(2131427863));
        return;
      }
      alertMessage(getString(2131427865));
      return;
    }
    alertMessage(getString(2131427394));
  }

  public void onClick(View paramView)
  {
    if (paramView == this.queding)
      quedingListener();
    if (paramView == this.quxiao)
      finish();
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903091);
    this.username = getIntent().getExtras().getString("username");
    init();
    addListener();
  }

  public class LoginAsyncTask extends AsyncTask<String, Integer, String>
  {
    private String method = "";

    public LoginAsyncTask()
    {
    }

    protected String doInBackground(String[] paramArrayOfString)
    {
      this.method = paramArrayOfString[0];
      if (this.method.equals("reg"))
      {
        DialogPSWActivity.this.rp = new RqSP();
        if (DialogPSWActivity.this.rp.getLgPwd(DialogPSWActivity.this).equals(MD5Builder.getMD5(DialogPSWActivity.this.oldPsw)))
          return DialogPSWActivity.this.bgReg();
        return DialogPSWActivity.this.getString(2131427393);
      }
      return "";
    }

    protected void onPostExecute(String paramString)
    {
      if (this.method.equals("reg"))
        DialogPSWActivity.this.PostShowReg(paramString);
      DialogPSWActivity.this.v_progressDialog.dismiss();
    }

    protected void onPreExecute()
    {
      if ((DialogPSWActivity.this.v_progressDialog == null) || (!DialogPSWActivity.this.v_progressDialog.isShowing()))
      {
        DialogPSWActivity.this.v_progressDialog = new ProgressDialog(DialogPSWActivity.this);
        DialogPSWActivity.this.v_progressDialog.setMessage(DialogPSWActivity.this.getString(2131427516));
        DialogPSWActivity.this.v_progressDialog.setCancelable(false);
        DialogPSWActivity.this.v_progressDialog.show();
      }
    }

    protected void onProgressUpdate(Integer[] paramArrayOfInteger)
    {
    }
  }
}

/* Location:           C:\Documents and Settings\Administrator\classes_dex2jar.jar
 * Qualified Name:     com.appwoo.txtws.activity.DialogPSWActivity
 * JD-Core Version:    0.6.2
 */